home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: usenet.eel.ufl.edu!warwick!bsmail!talisker!nathan
- From: nathan@pact.srf.ac.uk (Nathan Sidwell)
- Subject: Re: division problem
- Message-ID: <DLzvGG.2rn@uns.bris.ac.uk>
- Sender: usenet@uns.bris.ac.uk (Usenet news owner)
- Nntp-Posting-Host: talisker.pact.srf.ac.uk
- Organization: Inmos
- X-Newsreader: TIN [version 1.2 PL2]
- References: <31097D77.11AA@rain.org> <26JAN199622082450@erich.triumf.ca> <4eh246$u6h@airdmhor.gen.nz> <4ej4ha$66@fountain.mindlink.net>
- Date: Tue, 30 Jan 1996 12:45:52 GMT
-
- Gene Wirchenko (genew@mindlink.bc.ca) wrote:
- : gumboot@airdmhor.gen.nz (Simon Hosie) wrote:
-
- : >celcius = (fahrenheit - 32) * 5 / 9;
-
- : That's disgusting <g> as it doesn't round. Try it with 39 deg F:
- : (39-32)*5/9 ::= 7*5/9 ::= 35/9 ::= 3
- : but the actual value is 3.8... i.e. nearly 4. If you must int, 4
- : would be a better answer.
-
- Still no need to use floating point,
- celcius = ((fahrenheit - 32) * 5 + 4) / 9
-
- nathan
- --
- Nathan Sidwell Holder of the Xmris home page
- Chameleon Architecture Group at SGS-Thomson, formerly Inmos
- http://www.pact.srf.ac.uk/~nathan/ Tel 0117 9707182
- nathan@inmos.co.uk or nathan@bristol.st.com or nathan@pact.srf.ac.uk
-